﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using TTGame;

/*
 * DamageReceiverBoxCollider
 *
 *
 *
 * 依赖：
 *
 * ！不写重复代码！
 * @author TTun
 * @date 7/19/2017 9:42:48 AM
 */
public class DamageReceiverBoxCollider : DamageReceiverCollider {
    #region Fields

    public Transform boxCenter;

    Vector3 m_size = Vector3.one;
    Vector3 m_centerOffset = Vector3.zero;

    #endregion Fields

    #region Methods

    public void Init(Transform bindTF, Vector3 size, Vector3 centerOffset, LayerMask layerMask) {

        m_size = size;
        m_centerOffset = centerOffset;
        layersToHit = layerMask;

        if(bindTF != null) {
            boxCenter = bindTF;
        } else {
            boxCenter = transform;
        }
        init();
    }

    public override void CheckInsideColliderRay() {
        Collider[] s1 = Physics.OverlapBox(boxCenter.position + m_centerOffset, m_size, Quaternion.identity, layersToHit.value);
        AddColliers(s1);
    }

    public override bool PointInsideCollider(Vector3 aPoint) {
        return false;
    }

    void OnDrawGizmos() {
        if(DamageReceiverCollider.IsDrawColliderWire == false) {
            return;
        }
        Gizmos.color = Color.green;

        Gizmos.DrawWireCube(boxCenter.position + m_centerOffset, m_size);
    }

    #endregion Methods
}
